package com.cxz.food.service.impl;

import com.cxz.food.dao.FoodMapper;
import com.cxz.food.domain.Food;
import com.cxz.food.domain.FoodClass;
import com.cxz.food.domain.vo.FoodsResponseVo;
import com.cxz.food.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FoodServiceImpl implements FoodService {

    @Autowired
    private FoodMapper foodMapper;

    @Override
    public Integer addFood(Food food) throws Exception{
        return foodMapper.addFood(food);
    }

    @Override
    public Integer deleteFoodById(Integer id) throws Exception{
        return foodMapper.deleteFoodById(id);
    }

    @Override
    public Integer updateFood(Food food) throws Exception{
        return foodMapper.updateFood(food);
    }

    @Override
    public List<Food> getFoodsByBusinessId(Integer businessId) throws Exception{

        return  foodMapper.getFoodsByBusinessId(businessId);
    }

    @Override
    public FoodsResponseVo findFoodById(Integer foodId) throws Exception {
        return foodMapper.findFoodById(foodId);
    }

    @Override
    public List<FoodClass> getFoodClassByBusinessId(Integer businessId) throws Exception{
        return foodMapper.getFoodClassByBusinessId(businessId);
    }
}
